package net.sunzc.takephoto;

import android.graphics.Bitmap;
import android.hardware.Camera;
import android.view.SurfaceView;

/**
 * Created by Administrator on 2017/1/16.
 */
public interface ICamera {
    void takePhoto(PhotoListener listener);

    Size getPictureSize();

    void preview(SurfaceView surfaceView, Camera.PreviewCallback callback);

    void exit(ExitListener listener);

    interface ExitListener {
        void onExit();
    }

    class Size {
        public int width;
        public int height;

        public Size(int width, int height) {
            this.width = width;
            this.height = height;
        }

        @Override
        public String toString() {
            return "Size{" +
                    "width=" + width +
                    ", height=" + height +
                    '}';
        }
    }

    interface PhotoListener {
        /**
         * 采集图片
         * Camera拍照之后用来得到的图片的url
         *
         * @param sourceBytes
         * @param bitmap      照片的url
         */
        void fetchPhoto(byte[] sourceBytes, Bitmap bitmap);
    }
}
